package com.xy.smartsms.util;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import cn.com.xy.sms.sdk.util.BaseRunnable;

/**
 * Created by kangwenbo on 2017/3/27.
 */

public class ThreadManager {
    public static final ExecutorService NUMBER_UPDATE_CARRIER = Executors.newFixedThreadPool(2);    //用于更新操作，上报数据插入数据库操作，频率较低
    public static final ExecutorService NUMBER_PRELOADDATA = Executors.newFixedThreadPool(1);       //用于预加载操作，频率中

    public static void executeRunnableByPool(ExecutorService executorService, BaseRunnable runnable) {
        if (executorService == null || runnable == null || runnable.isRunning()) {
            return;
        }
        executorService.execute(runnable);
    }
}
